<template>
  <div class="hidden-danger-info-root">
    <div class="table-con">
      <el-scrollbar>
        <info-table ref="infoTable" :table-config="infoConfig" :data="infoData"></info-table>
      </el-scrollbar>
    </div>
    <div class="flow-con">
      <el-scrollbar>
        <hidden-danger-flow ref="danFlow" :info-data="infoData"></hidden-danger-flow>
      </el-scrollbar>
    </div>
    <div class="clea-con">
      <el-scrollbar>
        <CleanPitfall ref="clean" :type="'show'" :rec-data="infoData" :inspect-info="inspectInfo"></CleanPitfall>
      </el-scrollbar>
    </div>
  </div>
</template>

<script>
import infoTable from "@/views/components/InfoTable/index.vue";
import HiddenDangerFlow from "@/views/checkBusPage/components/hiddenDangerFlow/index.vue";
import CleanPitfall from "@/views/checkBusPage/components/cleanPitfall/index.vue";

export default {
  components: {
    infoTable,
    HiddenDangerFlow,
    CleanPitfall,   //注册隐患整改组件
  },
  props: {
    infoData: {
      type: Object,
    },
    inspectInfo: {
      type: Object,
    },
  },
  data() {
    return {
      infoConfig: [
        {
          label: '所属检查',
          value: 'inspectName'
        },
        {
          label: '检查年份',
          value: 'questionYear'
        },
        {
          label: '所属企业名称',
          value: 'belongOrgName'
        },
        {
          label: '安全员姓名',
          value: 'undertakerName'
        },
        {
          label: '隐患来源',
          value: 'questionSourceName'
        },
        {
          label: '隐患来源机构',
          value: 'questionSourceOrgName'
        },

        {
          label: '隐患所属大类',
          value: 'parentTypeName'
        },
        {
          label: '隐患所属子类',
          value: 'childTypeName'
        },
        {
          label: '隐患类别',
          value: 'typeName'
        },
        {
          label: '整改进度',
          value: 'schedule',
          suffix: '%'
        },
        {
          label: '整改完成情况',
          value: 'situation'
        },
        {
          label: '整改建议',
          value: 'suggestion'
        },
        {
          label: '附件',
          value: 'fileVos',
          type: 'file'
        }
      ],
    }
  },
  methods: {
    reload() {
      let refList = ['danFlow', 'clean'];
      let owner = this
      refList.forEach(refName => {
        if (owner.$refs[refName]) {
          owner.$refs[refName].reload()
        }
      })
    }
  }
}
</script>

<style lang="scss" scoped>
.hidden-danger-info-root {
  display: flex;
  width: 100%;
  height: 100%;
  overflow: hidden;

  .table-con, .flow-con, .clea-con {
    height: 100%;
    overflow: hidden;
    box-sizing: border-box;
  }

  .table-con {
    width: 40%;
    padding-right: 20px;
  }

  .flow-con {
    width: 30%;
    padding-right: 20px;
  }

  .clea-con {
    width: 30%;
  }
}
</style>
